using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CanvasStaticAdapter : MonoBehaviour
{
    private CanvasScaler canvasScaler;

    private void Awake()
    {
        canvasScaler = GetComponent<CanvasScaler>();
        if (canvasScaler != null)
        {
            float sp = (float)Screen.width / (float)Screen.height;

            if (sp > ((float)16 / 9))
            {
                canvasScaler.matchWidthOrHeight = 1;
            }
            //else if(sp < 1.4f)
            //{
            //    canvasScaler.matchWidthOrHeight = sp - 1f;
            //}
            else
            {
                canvasScaler.matchWidthOrHeight = 0;
            }
        }        
    }
}
